<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.global.js"></script>
    <title>列表渲染</title>
</head>
<body>
    <div id="app">
    <!-- 方式1 -- 直接遍历数组中的元素 -->
        <!-- 途径1 -->
        <li v-for="item in items">
            {{item.message}}
        </li>

        <br>
        -----------------------
        <br>

        <!-- 途径2 -- 带数组索引的遍历数组中的元素-->
        <li v-for="(item, index) in items">
            {{parentMsg}} -- {{index}} -- {{item.message}}
        </li>

        
    </div>
    <script>
        const myApp = {
            data()
            {
                return {
                    parentMsg: 'parent',
                    items:[{message:'foo'}, {message:'bar'}]
                }
            }
        }

        Vue.createApp(myApp).mount("#app");
    </script>
</body>
</html>